package hos.load

/**
 * <p>Title: Loadable </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2024-08-06 14:36
 * @version : 1.0
 */


interface Loadable {

    fun getStatus(): LoadStatus

    fun getLoadError(): Throwable?

    fun cancelLoad()

    fun loadAsync()

    fun retryLoadAsync()

    fun addDoneLoadingListener(runnable: Runnable)

    fun removeDoneLoadingListener(runnable: Runnable): Boolean

    fun addLoadStatusChangedListener(listener: LoadStatusChangedListener)

    fun removeLoadStatusChangedListener(listener: LoadStatusChangedListener): Boolean

}

interface LoadableData<DATA> : Loadable {

    fun addDoneDataLoadingListener(runnable: DATA?.() -> Unit)

    fun removeDoneDataLoadingListener(runnable: DATA?.() -> Unit): Boolean

}